package org.myxdb.client;

import java.io.IOException;

import java.net.MalformedURLException;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Map;
import java.util.Vector;

import java.net.URL;

 

import org.apache.xmlrpc.XmlRpcException;

import org.apache.xmlrpc.client.XmlRpcClient;

import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

 

public class CopyOfClient{

      public static void main(String[] args) {

            try {

                  // config client

                  XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

                  config.setEnabledForExtensions(true);
                  
                  config.setServerURL(new URL("http://localhost:8080/myxdb/MyXdbServer"));      // should be modified according to your configuration of jsp container

                  // create a new XmlRpcClient object and bind above config object with it

                  XmlRpcClient client = new XmlRpcClient();

                  client.setConfig(config);
                  
                  

                  // create parameter list

                  Vector<String> params = new Vector<String>();

                 

                  // execute XML-RPC call
                  Map test = new HashMap();
                  
                  test.put("message", "Hello");
                                    
                  
                  Object a[] = new Object[]{test};
             
                 Map b = (Map)client.execute("run", a);                  

                  System.out.println(b.toString());

            } catch (MalformedURLException e) {

                  System.out.println(e.toString());

            } catch (XmlRpcException e) {

                  System.out.println(e.toString());

            } catch (IOException e) {

                  e.printStackTrace();

            }

      }

}
